package com.jpm.jroguefx.types;

public class Router extends Coords implements Comparable<Router> {

    private int distanceFromStart = Integer.MAX_VALUE, distanceToTarget = Integer.MAX_VALUE;
    private Router previousTile = null;
    private boolean checked = false;

    public Router(int x, int y) {
        super(x, y);
    }

    public boolean isChecked() {
        return checked;
    }

    public void setChecked() {
        checked = true;
    }

    public void setDistanceToTarget(int distanceToTarget) {
        this.distanceToTarget = distanceToTarget;
    }

    public int getDistanceFromStart() {
        return distanceFromStart;
    }

    public void setDistanceFromStart(int distanceFromStart) {
        this.distanceFromStart = distanceFromStart;
    }

    @Override
    public int compareTo(Router otherTile) {
        return (distanceFromStart + distanceToTarget) - (otherTile.distanceFromStart + otherTile.distanceToTarget);
    }

    public Router getPreviousTile() {
        return previousTile;
    }

    public void setPreviousTile(Router previousTile) {
        this.previousTile = previousTile;
    }
}
